//
//  HXCompanyNotifyDetailViewController.m
//  KD
//
//  Created by 梅洋 on 16/7/14.
//  Copyright © 2016年 Whx. All rights reserved.
//

#import "HXCompanyNotifyDetailViewController.h"

#import "WeiBoView.h"
#import "HXGetPersonalNotifyDetailModel.h"

#import "NSString+Frame.h"

@interface HXCompanyNotifyDetailViewController ()


@property (nonatomic,strong) NSMutableDictionary * weiboDataDic;

/**
 简介背景
 */
@property (weak, nonatomic) IBOutlet UIView *bgView1;

/**
 标题
 */
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;

/**
 发送人
 */
@property (weak, nonatomic) IBOutlet UILabel *authorLabel;

/**
 发送时间
 */
@property (weak, nonatomic) IBOutlet UILabel *sendDateLabel;

/**
 内容
 */
@property (weak, nonatomic) IBOutlet WeiBoView *contentView;



@end

@implementation HXCompanyNotifyDetailViewController

///**
// 重写init方法 需要 1.messageID
// */
//-(instancetype)initWithMessageID:(NSString *)messageID{
//
//    self = [super init];
//    
//    if (self) {
//        
//        
//        self.navigationItem.title = @"通知详情";
//        self.view.backgroundColor = [UIColor whiteColor];
//        _messageId = messageID;
//        
//        NSLog(@"------ mssageId is %@",messageID);
//
//    }
//    
//    return self;
//}

/**
 加载数据
 */
-(void)loadCreateData{

    _weiboDataDic = [NSMutableDictionary dictionary];
    
    [SVProgressHUD showWithStatus:@"正在加载..."];

    [NetworkAPI getCompanyPersonalNotifyDetailWithMessageID:self.messageId
                                                    Success:^(HXGetPersonalNotifyDetailModel *result) {
                                                        
                                                        if ([result.code isEqualToString:@"200"]) {
                                                            
                                                            [SVProgressHUD dismiss];
                                                            
                                                            _titleLabel.text = result.details.Title;
                                                            _authorLabel.text = result.details.Author;
                                                            _sendDateLabel.text = result.details.SendDate;
                                                            
                                                            HXGetPersonalNotifyDetailShowModel * showModel = result.details;
                                                            [_weiboDataDic setObject:showModel forKey:@"details"];
                                                            
                                                            NSArray * piclist = result.piclist;
                                                            [_weiboDataDic setObject:piclist forKey:@"piclist"];
                                                            
                                                            _contentView.companyNotifierDataDic = _weiboDataDic;
                                                        }
                                                        
                                                    } failure:^(NSError *err) {
                                                        
                                                        [SVProgressHUD showErrorWithStatus:@"网络错误!"];
                                                    }];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.navigationItem.title = @"通知详情";
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self loadCreateData];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
